//$Id: Dialect.java,v 1.64 2005/12/12 08:57:26 maxcsaucdk Exp $
package org.mk.dialect;

import java.util.HashMap;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Represents a dialect of SQL implemented by a particular RDBMS.
 * Subclasses implement Hibernate compatibility with different systems.<br>
 * <br>
 * Subclasses should provide a public default constructor that <tt>register()</tt>
 * a set of type mappings and default Hibernate properties.<br>
 * <br>
 * Subclasses should be immutable.
 *
 * @author Gavin King, David Channon
 */
public abstract class Dialect {

	private static final Log log = LogFactory.getLog( Dialect.class );

	static final String DEFAULT_BATCH_SIZE = "15";
	static final String NO_BATCH = "0";

	private static final Map STANDARD_AGGREGATE_FUNCTIONS = new HashMap();

	static {
//		STANDARD_AGGREGATE_FUNCTIONS.put( "count", new StandardSQLFunction("count") {
//			public Type getReturnType(Type columnType, Mapping mapping) {
//				return Hibernate.INTEGER;
//			}
//		} );
//
//		STANDARD_AGGREGATE_FUNCTIONS.put( "avg", new StandardSQLFunction("avg") {
//			public Type getReturnType(Type columnType, Mapping mapping) throws QueryException {
//				int[] sqlTypes;
//				try {
//					sqlTypes = columnType.sqlTypes( mapping );
//				}
//				catch ( MappingException me ) {
//					throw new QueryException( me );
//				}
//				if ( sqlTypes.length != 1 ) throw new QueryException( "multi-column type in avg()" );
//				int sqlType = sqlTypes[0];
//				if ( sqlType == Types.INTEGER || sqlType == Types.BIGINT || sqlType == Types.TINYINT ) {
//					return Hibernate.FLOAT;
//				}
//				else {
//					return columnType;
//				}
//			}
//		} );

//		STANDARD_AGGREGATE_FUNCTIONS.put( "max", new StandardSQLFunction("max") );
//		STANDARD_AGGREGATE_FUNCTIONS.put( "min", new StandardSQLFunction("min") );
//		STANDARD_AGGREGATE_FUNCTIONS.put( "sum", new StandardSQLFunction("sum") );
	}


	
}
